<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>用户信息管理</title>
	<meta name="decorator" content="default"/>
	<script src="${ctxStatic}/layer/layer.js"></script>
	<script src="${ctxStatic}/js/widget/stickytableheaders/js/jquery.stickytableheaders.min.js"></script>
    <script src="http://api.map.baidu.com/api?v=2.0&ak=5RVK94VG4wr1KgfzG2ikW6vbLVAiieiY" type="text/javascript"></script>
	<script src="${ctxStatic}/echarts/echarts.min.js"></script>
	<script type="text/javascript">
		$(document).ready(function() {
			$(".view_service_record").click(function(){
				var id=$(this).data("id");
					parent.layer.open({
						  type: 2,
						  title: '服务记录',
						  shadeClose: true,
						  shade: 0,
						  area: ['90%', '70%'],
						  content: '${ctx}/sys/member/member/seviceRecordPage?id='+id //iframe的url
					}); 
			});
			$("#contentTable").stickyTableHeaders();
            $('.business_record').on('click', function(){
                var id=$(this).data("id");
                parent.layer.open({

                    closeBtn:1,
                    type: 2,
                    title: '商务人员谈单记录',
                    shade: 0,
//                    offset: ['100px', '50px'],
                    area: ['90%', '70%'],
                    shadeClose: true, //点击遮罩关闭
                    content: '${ctx}/sys/member/member/businessRecordPage?id='+id,
                    cancel: function(index, layero){
                        layer.close(index);
                        window.location.reload();
                    }
                });
            });
            $('.service_menu').on('click', function(){
                var id=$(this).data("id");
                parent.layer.open({

                    closeBtn:1,
                    type: 2,
                    title: '综合菜单',
                    shade: 0,
//                    offset: ['100px', '50px'],
                    area: ['90%', '70%'],
                    shadeClose: true, //点击遮罩关闭
                    content: '${ctx}/sys/member/member/menu?id='+id
                });
            });
            $('.gps_map').on('click', function(){
                var id=$(this).data("id");
                parent.layer.open({
                    closeBtn:1,
                    type: 2,
                    title: '客户足迹',
                    shade: 0,
//                    offset: ['100px', '50px'],
                    area: ['800px', '600px'],
                    shadeClose: true, //点击遮罩关闭
                    content: '${ctx}/sys/gps/gps/getmap?id='+id
                });
            });
            $(".view-info").click(function(){
                var id=$(this).data("id");
                layer.open({
                    type: 2,
                    title:"客户信息",
                    skin: 'layui-layer-rim', //加上边框
                    offset: ['50px', '100px'],
                    area: ['900px', '90%'], //宽高
                    content: "${ctx}/sys/loan/customPay/load/viewMemberInfoPage1?id="+id
                });
            });
            $('#clearfix').click(function () {
                $('#realname').val("");
                $('#username').val("");
                $('#idCard').val("");
                $('#createDate').val("");
                $('#updateDate').val("");
                $('#btnSubmit').click();
            });
            $('.manageNames').click(function () {
				var managerid = $(this).data("managerid");
				layer.open({
				   type:2,
					title:"商务人员/客服人员信息",
					area:['600px','540px'],
					offset:'100px',
					content:"${ctx}/sys/member/member/getManage?managerid="+managerid
				});
            });
            $('.manageremaks').click(function () {
				var id = $(this).data("id");
                layer.open({
                    type:2,
                    title:"客户交款信息",
                    area:['600px','300px'],
                    offset:'100px',
                    content:"${ctx}/sys/member/member/getRemakes?id="+id,
                    cancel: function(index, layero){
                        layer.close(index);
                        window.location.reload();
                    }
                });
            })
		});

		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		function keyLogin(){
			if (event.keyCode==13)  //回车键的键值为13
                    document.getElementByIdx_x("btnSubmit").click(); //调用登录按钮的登录事件
		}
	</script>


</head>
<body onkeydown="keyLogin()">
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/sys/member/member/">用户信息列表</a></li>
		<shiro:hasPermission name="sys:member:member:edit"><li><a href="${ctx}/sys/member/member/form">用户信息添加</a></li></shiro:hasPermission>
	</ul>

	<form:form id="searchForm" modelAttribute="member" action="${ctx}/sys/member/member/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
            <li><label>真实姓名：</label>
                <input id="realname" name="realname" value="${member.realname}" htmlEscape="false" maxlength="64" class="input-medium"/>
				<%--<form:select path="realname" cssStyle="min-width: 110px;" >--%>
					<%--<option value="">==请选择==</option>--%>
					<%--<form:options items="${nams}" itemLabel="realname" itemValue="realname" htmlEscape="false"/>--%>
				<%--</form:select>--%>
            </li>
			<li><label>电话：</label>
				<input  id="username" name="username" value="${member.username}" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>身份证号码：</label>
				<input id="idCard" name="idCard" value="${member.idCard}" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>商务人员：</label>
				<input id="managerName" name="managerName" value="${member.managerName}" htmlEscape="false" maxlength="64" class="input-medium"/>
			</li>
			<li><label>创建时间：</label>
				<input id="createDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					   name="createDate" value="<fmt:formatDate value="${member.createDate}" pattern="yyyy-MM-dd"/>"	onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/> -
				<input id="updateDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate "
					   name="updateDate" value="<fmt:formatDate value="${member.updateDate}" pattern="yyyy-MM-dd"/>"	onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="btns"><input id="clearfix" class="btn btn-primary" type="reset" value="重置"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
			<table id="contentTable" class="table table-striped table-bordered table-condensed">
				<thead style="top: 0">
				<tr>
					<%--<th style="width: 4%">电话号码</th>--%>
					<%--<th style="width: 5%">昵称</th>--%>
					<th style="width: 4%">昵称/真实姓名</th>
					<th style="width:4%">商务人员</th>
						<th style="width:4%">客服人员</th>
					<th style="width: 1%">性别</th>
						<th style="width: 1%">年龄</th>
					<th style="width: 4%">出生日期</th>
					<th style="width: 5%">身份证号码</th>
					<th style="width: 7%">财务收款</th>
					<th style="width: 4%">创建时间</th>
					<shiro:hasPermission name="sys:member:member:sr:view">
						<th style="width: 4%">服务记录</th>
					</shiro:hasPermission>
					<%--<shiro:hasPermission name="sys:businessrecord:tBusinessRecord:view">--%>
						<%--<th style="width: 2%">商务记录</th>--%>
					<%--</shiro:hasPermission>--%>
					<shiro:hasPermission name="sys:member:member:operating">
					     <th style="width: 10%">操作</th>
					</shiro:hasPermission>
				</tr>
				</thead>
				<tbody >
				<c:forEach items="${page.list}" var="member">
					<tr>
						<%--<td style="width: 5%"><a href="#" href="javascript:void(0)" class="view-info"   data-id="${member.id}">--%>
							<%--${member.usernameFake}--%>
						<%--</a></td>--%>
						<td style="width: 5%"><a href="#" href="javascript:void(0)" class="view-info"   data-id="${member.id}">
								<c:if test="${member.realname == null }">${member.nickname}</c:if>

								${member.realname}(${member.usernameFake})
						</a></td>
						<%--<td style="width: 5%"><a href="${ctx}/sys/member/member/form?id=${member.id}">--%>
							<%--${member.realname}--%>
						<%--</td>--%>
						<td style="width: 5%"><a href="#" href="javascript:void(0)" class="manageNames" data-managerid="${member.managerId}">
								${member.managerName}
						</a></td>
							<td style="width: 5%">
									${fnc:getCustomName(member.id)}
							</td>
						<td style="width: 1%">
								${member.sex}
						</td>
							<td id="age" data-age="${member.idCard}" style="width: 1%;text-align: center;">
									${fnc:getAge(member.id)}
								<c:if test="${fnc:getAge(member.id) ==null}">${fnc:getAge2(member.birthdayStr)}</c:if>
							</td>
						<td style="width: 5%">
								${member.birthdayStr}
						</td>
						<td style="width: 5%">
							${member.idCard}
						</td>
						<td style="width: 7%"><a href="#" href="javascript:void(0)" class="manageremaks" data-id="${member.id}">
							<div style="white-space: nowrap;overflow:hidden;width:130px;height: 50px;">
								<c:if test="${member.remarks == null || member.remarks == ''} ">新增</c:if>
								<c:if test="${ not empty member.remarks}">${member.remarks}</c:if></div>
						</a></td>
						<td style="width: 4%">
							<fmt:formatDate value="${member.createDate}" pattern="yyyy-MM-dd" />
						</td>
				<%--		<td style="width: 5%">
							<fmt:formatDate value="${member.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
						</td>
						<td style="width: 5%">
							${member.remarks}
						</td>--%>
						<%--<shiro:hasPermission name="sys:member:member:sr:view">--%>
						<%--<td style="width: 2%">--%>
						<%--<a href="#" class="view_service_record" data-id="${member.id}">查看[${member.servicenum}条]</a>--%>
						<%--</td>--%>
						<%--</shiro:hasPermission>--%>
                            <shiro:hasPermission name="sys:member:member:sr:view">
                                <td style="width: 4%">
                                    <a href="#" class="service_menu" data-id="${member.id}">查看更多</a>
                                </td>
                            </shiro:hasPermission>
						<%--<shiro:hasPermission name="sys:businessrecord:tBusinessRecord:view">--%>
							<%--<td style="width: 2%">--%>
								<%--<a href="#" class="business_record" data-id="${member.id}">查看[${member.businessnum}条]</a>--%>
							<%--</td>--%>
						<%--</shiro:hasPermission>--%>
						<shiro:hasPermission name="sys:member:member:operating">
							<td style="width: 10%">
								<shiro:hasPermission name="sys:member:member:edit">	<a href="${ctx}/sys/member/member/form?id=${member.id}">修改</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:bankcardmanager"><a href="${ctx}/sys/member/member/bankcardList?id=${member.id}">银行卡管理</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:uploadmaterial">	<a  href="${ctx}/sys/member/member/uploadPage?id=${member.id}">上传资料</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:downloadmaterial"><a href="${ctx}/sys/member/member/downLoadMaterials?id=${member.id}" onclick="return confirmx('确认要下载该用户的资料吗？', this.href)">下载资料</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:inputapply"><a  href="${ctx}/sys/member/member/inputApplyPage?id=${member.id}">客户录单</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:applymaterial"><a  href="${ctx}/sys/member/member/checkFormPage?id=${member.id}">审核资料</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:delete"><a href="${ctx}/sys/member/member/delete?id=${member.id}" onclick="return confirmx('确认要删除该用户信息吗？', this.href)">删除</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:applymaterial"><a  href="${ctx}/sys/member/member/membermate?id=${member.id}">产品匹配度</a></shiro:hasPermission>
								<shiro:hasPermission name="sys:member:member:gps"><a href="#" class="gps_map" data-id="${member.id}">客户足迹</a></shiro:hasPermission>
							</td>
						</shiro:hasPermission>
					</tr>
				</c:forEach>
				</tbody>
			</table>
			<div class="pagination">${page}</div>

</body>
</html>